import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '../components/Index'
import Use from '../components/Use'
import Manager from "../components/Manager"
import Forgot from "../components/Forgot"
import System from "../components/System"
import News from "../components/News";

Vue.use(Router);

export default new Router({
	routes: [
		{
			path: '/',
			name: 'index',
			component: HelloWorld
		},
		{
			path: '/use',
			name: 'use',
			component: Use
		},
		{
			path: '/manager',
			name: 'manager',
			component: Manager
		},
		{
			path: '/forgot',
			name: 'forgot',
			component: Forgot
		},
		{
			path: '/system',
			name: 'system',
			component: System,
			beforeEnter: (to, from, next) => {
				if(from.name === 'manager' || from.name ==='system'){
					next();
				}else {
					next("/");
				}

			}
		},
		{
			path: '/news',
			name: 'news',
			component: News,
		}
	]
})
